package com.itheima.service.impl;

import com.itheima.pojo.User;
import com.itheima.mapper.UserMapper;
import com.itheima.service.IUserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户表 服务实现类
 * </p>
 *
 * @author dida
 * @since 2023-08-25
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserService {

    @Override
    public List<User> getUserByIds(List<Integer> ids) {
        List<User> users = lambdaQuery()
                .in(User::getId, ids)
                .list();
        return users;
    }

    @Override
    public User checkUser(String username, String password) {
      User user=  lambdaQuery()
                .eq(User::getUsername,username)
                .eq(User::getPassword,password)
                .one();
      return user;
    }
}
